﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Factura.aspx.cs" Inherits="ForrajeriaFRONT.Factura" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style3
        {
            width: 21px;
        }
        .style4
        {
            width: 28px;
        }
        .style6
        {
            width: 36px;
        }
        .style8
        {
            width: 42px;
        }
        .style10
        {
            width: 152px;
        }
        .style12
        {
            width: 82px;
        }
        .style13
        {
            width: 132px;
        }
        .style14
        {
            width: 88px;
        }
        .style15
        {
            width: 40px;
        }
        .style17
        {
            width: 63px;
        }
        .style18
        {
            width: 82px;
            height: 102px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" />
     <asp:Panel ID="panelCliente" runat="server">
     <table>
            <tbody>
                 <tr>
                    <td class="style13">
                        <asp:Label ID="lblTipoFactura" runat="server" Text="Factura Tipo"></asp:Label>
                     </td>
                    <td class="style3">
                        <asp:DropDownList ID="ddlTipoFactura" runat="server" Width="75px" >
                            <asp:ListItem>A</asp:ListItem>
                            <asp:ListItem>B</asp:ListItem>
                            <asp:ListItem>C</asp:ListItem>
                        </asp:DropDownList>
                    </td>


                </tr>
                
               
               <tr> 
                    <td class="style13"> <h5>Cliente:</h5></td>
                    <td>&nbsp;</td>
                    <td></td>
               </tr>
               <tr>
                    <td class="style13">
                        <asp:Label ID="lblNombreCliente" runat="server" Text="Nombre"></asp:Label>
                    </td>
                    <td><asp:TextBox ID="txtNombreCliente" runat="server" Text=""></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label ID="lblNroCliente" runat="server" Text="Numero Cliente"></asp:Label>
                     </td>
                    <td>
                        <asp:TextBox ID="txtNroCliente" runat="server" Enabled="False" Text=""></asp:TextBox>
                    </td>
                    <td>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                            ControlToValidate="txtNroCliente" ErrorMessage="Debe Buscar un Cliente" 
                            ForeColor="Red">*</asp:RequiredFieldValidator>
                    </td>
               </tr>
                 <tr>
                    <td class="style13">
                        <asp:Label ID="lblApellidoCliente" runat="server" Text="Apellido"></asp:Label>
                     </td>
                    <td class="style3"><asp:TextBox ID="txtApellidoCliente" runat="server" Text=""></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;</td>
                    <td>&nbsp;</td>
                     <td>&nbsp;</td>
                </tr>
                 <tr>
                    <td class="style13">
                        <asp:Label ID="lblNroDocumento" runat="server" Text="Numero Documento:"></asp:Label>
                     </td>
                    <td class="style3">
                        <asp:TextBox ID="txtDocumentoCliente" runat="server" Text=""></asp:TextBox>
                        
                     </td>
                    <td>
                        <asp:Button ID="btnBuscarCliente" runat="server" CausesValidation="false" 
                            onclick="btnBuscarCliente_Click" Text="BuscarCliente" />
                     </td>
                    <td>
                        &nbsp;</td>
                </tr>
                
                 

            </tbody>
        </table>
        
    <div>

        <asp:GridView ID="gvCliente" runat="server" AutoGenerateColumns="False" 
                CellPadding="4" ForeColor="#333333" GridLines="None" 
                onselectedindexchanging="gvCliente_SelectedIndexChanging" 
                DataKeyNames="Codigo" 
                EmptyDataText="No hay Datos para Mostrar" Visible="False">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="NombreCliente" HeaderText="Nombre" />
                <asp:BoundField DataField="ApellidoCliente" HeaderText="Apellido" />
                <asp:BoundField DataField="NumeroDocumento" HeaderText="Documento" />
                <asp:CommandField ButtonType="Image" HeaderText="Seleccione" 
                    SelectImageUrl="~/Images/selectBusqueda.jpg" ShowSelectButton="True" />
            </Columns>
            <EditRowStyle BackColor="#7C6F57" />
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#E3EAEB" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F8FAFA" />
            <SortedAscendingHeaderStyle BackColor="#246B61" />
            <SortedDescendingCellStyle BackColor="#D4DFE1" />
            <SortedDescendingHeaderStyle BackColor="#15524A" />
        </asp:GridView>
        </div>
    
     </asp:Panel>
<asp:Panel ID="panelPedido" runat="server">
         
     <table class="style1">
         
             <tr>
                    <td class="style10">
                        &nbsp;</td>
                    <td class="style17">
                        &nbsp;</td>
                    <td>&nbsp;</td>

                </tr>
             <tr>
                    <td>
                        <asp:Label ID="lblNumeroPedido" runat="server" Text="Numero De Pedido" 
                            ForeColor="Black"></asp:Label>
                    </td>
                    <td class="style17">
                        <asp:TextBox ID="txtNroPedido" runat="server" Text="" Enabled="False" 
                            Width="104px"></asp:TextBox>
                    </td>
                    <td><asp:Button ID="btnBuscarPedido" runat="server" Text="Buscar Pedido" 
            onclick="btnBuscarPedido_Click"  CausesValidation="true" />
                     </td>

                </tr>
         </tr>
     </table>
     <asp:GridView ID="gvPedido" runat="server"   
            CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%" 
            OnSelectedIndexChanging="gvPedido_SelectedIndexChanging" 
         AutoGenerateColumns="False" Visible="False" DataKeyNames="id_cliente">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <Columns>
            <asp:BoundField DataField="nroPedido" HeaderText="Numero Pedido"/>
            <asp:BoundField DataField="FechaPedido" HeaderText="Fecha de Pedido"/>
            <asp:BoundField DataField="FechaAuto" HeaderText="Fecha de Autorizacion"/>
            <asp:BoundField DataField="FechaDeseada" HeaderText="Fecha Deseada"/>
            <asp:BoundField DataField="totalPedido" HeaderText="Total Pedido"/>
            <asp:CommandField ButtonType="Image" CancelText="" InsertText="" NewText="" 
                    SelectText="" UpdateText="" EditText="" 
                    HeaderText="Seleccionar" SelectImageUrl="~/images/selectBusqueda.jpg" 
                    ShowSelectButton="True" />
           
        </Columns>
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" 
                HorizontalAlign="Center" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#EDEAE4" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#E9E7E2" />
        <SortedAscendingHeaderStyle BackColor="#506C8C" />
        <SortedDescendingCellStyle BackColor="#FFFDF8" />
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
    </asp:GridView>

    </asp:Panel>
        <asp:Panel ID="panelForraje" runat="server">
        <table >
            <tbody>
            <tr><td class="style18" colspan="6">  
                <asp:ValidationSummary ID="ValidationSummary2" runat="server" ForeColor="Red" 
                    ValidationGroup="gForraje" Width="498px" />
                </td></tr>
                <tr>
                <td class="style12"></td>
                    <td>
                        <asp:Button ID="btnBuscarForraje" runat="server" CausesValidation="false" 
                            onclick="btnBuscarForraje_Click" Text="Buscar Forraje" />
                    </td>
                    <td class="style15">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style12"><asp:Label ID="lblForraje" runat="server" Text="Forraje"></asp:Label>
                    </td>
                    <td class="style6"><asp:TextBox ID="txtForraje" runat="server" Text="" ></asp:TextBox></td>
                    <td class="style15">
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="txtForraje" ErrorMessage="Busque un Forraje" ForeColor="Red" 
                            ValidationGroup="gForraje">*</asp:RequiredFieldValidator>
                    </td>
                    <td class="style14">
                        <asp:Label ID="lblCodigoForraje" runat="server" Visible="False"></asp:Label>
                    </td>
                    <td>&nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style12"><asp:Label ID="lblMarca" runat="server" Text="Marca"></asp:Label>
                    </td>
                    <td class="style6">
                        <asp:DropDownList ID="ddlMarca" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td class="style15">
                        &nbsp;</td>
                    <td class="style14">
                        <asp:Label ID="lblPeso" runat="server" Text="Peso Paquete"></asp:Label></td>
                    <td class="style4">
                        <asp:TextBox ID="txtPeso" runat="server" Text="" Enabled="False"></asp:TextBox>
                   </td>
                    <td class="style4">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style12">
                        <asp:Label ID="lblEdad" runat="server" Text="Edad"></asp:Label></td>
                    <td class="style6">
                        <asp:DropDownList ID="ddlEdad" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td class="style15">
                        &nbsp;</td>
                    <td class="style14">
                        <asp:Label ID="lblPrecioXKilo" runat="server" Text="Precio Por Kilo"></asp:Label>
                    </td>
                    <td class="style4">
                    
                        <asp:TextBox ID="txtPrecioXkilo" runat="server" 
                            Text="" Enabled="False"></asp:TextBox>
                    
                    </td>
                    <td class="style4">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style12" rowspan="1">
                        <asp:Label ID="lblAnimal" runat="server" Text="Animal"></asp:Label>
                    </td>
                    <td class="style6" rowspan="1">
                        <asp:DropDownList ID="ddlAnimal" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td class="style15" rowspan="1">
                        &nbsp;</td>
                    <td class="style14">
                        <asp:Label ID="lblCantidad" runat="server" Text="Cantidad"></asp:Label>
                    </td>
                    <td class="style4">
                        <asp:TextBox ID="txtCantidad" runat="server" />
                    </td>
                    <td class="style4">
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                            ControlToValidate="txtCantidad" ErrorMessage="Ingrese una cantidad" 
                            ForeColor="Red" ValidationGroup="gForraje">*</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td class="style12">
                        <asp:Label ID="lblDescripcion" runat="server" Text="Descripcion"></asp:Label>
                    </td>
                    <td class="style8" rowspan="2">  
                        <asp:TextBox ID="txtDescripcion" runat="server" Enabled="False" Rows="2" 
                            text="" TextMode="MultiLine" Width="186px"></asp:TextBox>
                    </td>
                    <td class="style15"></td>
                    <td class="style14">
                        &nbsp;</td>
                    <td class="style8" >
                               &nbsp;</td>
                    
                    <td class="style8">
                        &nbsp;</td>
                    
                </tr>
                <tr><td class="style12">  &nbsp;</td><td class="style15">
                    &nbsp;</td>
                    <td class="style14">
                        <asp:Button ID="btnCancelar" runat="server" onclick="btnCancelar_Click" 
                            Text="Cancelar Forraje" />
                    </td>
                    <td>  
                        <asp:Button ID="btnDetalle" runat="server" Text="Agregar Detalle" 
                        onclick="btnDetalle_Click" ValidationGroup="gForraje" /></td>
                    <td>
                        &nbsp;</td>
                </tr>
            </tbody>
        </table>

        <asp:GridView ID="gvForraje" runat="server" CellPadding="4" ForeColor="#333333" 
                GridLines="None" AutoGenerateColumns="False" 
                EmptyDataText="No hay forrajes para mostrar" 
                DataKeyNames="codigoForraje,stock,descripcionForraje,stockMinimo,stockMaximo,codigoEdad,codigoMarca,codigoAnimal" 
                onselectedindexchanging="gvForraje_SelectedIndexChanging" Visible="False" 
                Width="90%">
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:BoundField DataField="nombre" HeaderText="Nombre" />
        <asp:BoundField DataField="marca" HeaderText="Marca" />
        <asp:BoundField DataField="edad" HeaderText="Edad" />
        <asp:BoundField DataField="animal" HeaderText="Animal" />
        <asp:BoundField DataField="peso" HeaderText="Peso" />
        <asp:BoundField DataField="precio" HeaderText="Precio Kilo" />
        <asp:CommandField ButtonType="Image" CancelText="" DeleteText="" 
            EditText="Editar" HeaderText="Seleccione" InsertText="" NewText="" 
            SelectImageUrl="~/Images/selectBusqueda.jpg" SelectText="select" 
            ShowSelectButton="True" UpdateText="" />
    </Columns>
    <EditRowStyle BackColor="#7C6F57" />
    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#E3EAEB" />
    <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F8FAFA" />
    <SortedAscendingHeaderStyle BackColor="#246B61" />
    <SortedDescendingCellStyle BackColor="#D4DFE1" />
    <SortedDescendingHeaderStyle BackColor="#15524A" />
</asp:GridView>
        </asp:Panel>
       
    <asp:Panel ID="panelDetalle" runat="server"  
          Width="100%">
     
   <asp:Label ID="lblDetalle" runat="server" Text="Detalles  " Font-Size="Large" 
            Visible="False" />
   
   
    <div id="detalles">
        <asp:GridView ID="gv_detalles" runat="server" AutoGenerateColumns="False"  
            CellPadding="4" ForeColor="#333333" GridLines="None" ShowHeaderWhenEmpty="True" 
            Width="90%" Height="137px" DataKeyNames="codigoForraje" 
            onrowdeleting="gv_detalles_RowDeleting" 
            EmptyDataText="No hay Datos para Mostrar" >
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="cantidad" HeaderText="Cantidad" />
                <asp:BoundField DataField="peso" HeaderText="Peso" />
                <asp:BoundField DataField="descripcion" HeaderText="Descripcion" />
                <asp:BoundField DataField="precioKilo" HeaderText="Precio Por Kilo" />
                <asp:BoundField DataField="precio" HeaderText="Subtotal" />
                <asp:CommandField ButtonType="Image" DeleteImageUrl="~/images/borrarABM.jpg" 
                    HeaderText="Quitar" ShowDeleteButton="True" ShowHeader="True" />
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        
    </div>
   
   <table style="float:right">
<tr>
<td>
    &nbsp;</td>
<td>&nbsp;</td>
<td align="center" colspan="3">

    <asp:Label ID="lblTotal" runat="server"></asp:Label>
</td>
</tr>
       <tr>
           <td>
               <asp:Label ID="lblMensaje" runat="server" Text="" Visible="false"></asp:Label>
           </td>
           <td>
           </td>
           <td>
               <asp:Button ID="btnGuardar" runat="server" CausesValidation="true" 
                   Height="35px" onclick="btnGuardar_Click" Text="Guardar" 
                   ValidationGroup="cliente" Width="130px" />
           </td>
           <td>
           </td>
           <td>
               <asp:Button ID="btnNuevo" runat="server" CausesValidation="false" Height="35px" 
                   onclick="btnNuevo_Click" Text="Nuevo" Width="130px" />
           </td>
       </tr>
</table>
    </asp:Panel>

    
   
   

</asp:Content>
